/*lic*/
#ifndef __BSP_EEPROM_MODULE_H__
#define __BSP_EEPROM_MODULE_H__

#include "main.h"

#define EEPROM1_ADDR 0x50


typedef struct __Tag_Eeprom_Ctrl_Def {
  // 绑定状态，确定i2c的运行状态
  struct rt_semaphore transport_sem;
  CM_I2C_TypeDef *cm_i2c;
  I2c_Data_Task_Def *i2c_ctrl_obj;
  uint8_t arloie_try;         /* 总线仲裁失败次数 */
  struct rt_mutex eeprom_lock;// 设备是否被占用
  uint8_t addr;               // EEPROM设备地址
  uint32_t sink;
} Eeprom_Ctrl_Def;

extern Eeprom_Ctrl_Def eeprom_fram;

// 初始化EEPROM
rt_err_t Init_Eeprom(void);
// 读EEPROM地址
rt_err_t Read_Eeprom_Bytes(Eeprom_Ctrl_Def *obj, uint32_t address, uint8_t *data_buf, size_t data_len);
// 写EEPROM地址数据
rt_err_t Write_Eeprom_Bytes( Eeprom_Ctrl_Def* obj, uint32_t address, uint8_t *data_buf, size_t data_len );

#endif /* __BSP_EEPROM_MODULE_H__ */

/*eof*/
